package com.dc.around;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import com.dc.around.Manage.Manage;
import com.dc.around.model.Information;
import com.dc.around.tools.Constant;
import com.dc.around.tools.Tools;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

public class MyActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    TextView textView;

    List<Information> informationList;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final Manage manage =   new Manage();
        final String[] msg = new String[1];
//        AsyncTask asyncTask  = new AsyncTask() {
//            @Override
//            protected Object doInBackground(Object... objects) {
//                try {
//                    informationList = manage.getInformationList();
//                } catch (IOException e) {
//                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//                } catch (JSONException e) {
//                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//                }
//                return null;
//            }
//
//            @Override
//            protected void onPostExecute(Object o) {
//
//
//
//                textView = (TextView) findViewById(R.id.searchid);
//
//
//                textView.setText( informationList.get(0).getName());
//
//            }
//        };
//        asyncTask.execute(null);
//




    }

}
















// 创建URL对象
//        URL myURL = null;
//        try {
//            myURL = new URL("https://api.weibo.com/2/location/pois/search/by_geo.json?q=%E7%90%86%E6%83%B3%E5%9B%BD%E9%99%85%E5%A4%A7%E5%8E%A6&coordinate=116.322479%2C39.980781&access_token=2.00MeOHKER5AgYDb6f3146eb7ErwDKD");
//        } catch (MalformedURLException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        }
//                String a = "";
//        // 创建HttpsURLConnection对象，并设置其SSLSocketFactory对象
//        HttpsURLConnection httpsConn = null;
//        try {
//            httpsConn = (HttpsURLConnection) myURL.openConnection();
//
//            InputStreamReader insr = new InputStreamReader(httpsConn.getInputStream());
//            int respInt = insr.read();
//            while (respInt != -1) {
//               a = a+(char) respInt;
//                respInt = insr.read();
//            }
//
//        } catch (IOException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        }
//
//
//
//
//



//
//        HttpGet request = new HttpGet("http://www.baidu.com");
//        request.addHeader("Content-Type", "application/json");
//        request.addHeader("charset", "UTF-8");
//        HttpResponse httpResponse = null;
//
//        String msg = null;
//        try {
//
//            httpResponse = new DefaultHttpClient().execute(request);
//             msg = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
//        } catch (IOException e) {
//
//        }

//
//        JSONTokener jsonTokener = null;
//        try {
//            jsonTokener = new JSONTokener(EntityUtils.toString(httpResponse.getEntity(), "UTF-8"));
//        } catch (IOException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        }
//
//
//        String person = null;
//
//
//
